include("cl_roundedbox.lua")
surface.CreateFont ("tahoma", 32, 500, true, false, "Tahoma32") 
surface.CreateFont ("arial", 24, 500, true, false, "Arial24") 

function GM:HUDPaint()

	if LocalPlayer():Alive() then

		--Begin health panel
		RoundedBoxEx2( 4, 0, ScrH() - 90, 150, 32, Color( 20, 20, 20, 180 ),false,true,false,true )
		surface.SetTexture(surface.GetTextureID( "inv_healthicon"))
		surface.SetDrawColor( 255,255, 255, 255 )
		surface.DrawTexturedRect( 10, ScrH() - 90, 32, 32 )
		draw.SimpleText( LocalPlayer():Health(), "Arial24", 90, ScrH() - 85, Color(255, 255, 255, 255), 1, 0)
		RoundedBoxEx2( 4, 0, ScrH() - 55, 150, 24, Color( 20, 20, 20, 180 ),false,true,false,true )
		surface.SetTexture(surface.GetTextureID( "inv_xpicon"))
		surface.SetDrawColor( 255,255, 255, 255 )
		surface.DrawTexturedRect( 10, ScrH() - 60, 32, 32 )
		draw.RoundedBox( 0, 45, ScrH() - 46, 100, 5, Color( 255, 255, 255, 50 ) )
		
		--Begin ammo panel
		actwep = LocalPlayer():GetActiveWeapon()
		if actwep.Clip1 then
			playerClip1 = math.max(actwep:Clip1(),0) 
			RoundedBoxEx2( 3, ScrW() - 150, ScrH() - 90, 150, 60, Color( 20, 20, 20, 180 ),true,false,true,false )
			surface.SetTexture(surface.GetTextureID( "inv_ammoicon"))
			surface.SetDrawColor( 255,255, 255, 255 )
			surface.DrawTexturedRect( ScrW() - 150, ScrH() - 88, 32, 32 )
			draw.SimpleText( playerClip1.." / "..LocalPlayer():GetAmmoCount(actwep:GetPrimaryAmmoType()), "Arial24", ScrW() - 65, ScrH() - 85, Color(255, 255, 255, 255), 1, 0)
			
			
			surface.SetTexture(surface.GetTextureID( "inv_secondaryicon"))
			surface.SetDrawColor( 255,255, 255, 255 )
			surface.DrawTexturedRect( ScrW() - 150, ScrH() - 58, 32, 32 )
			
			draw.SimpleText( LocalPlayer():GetAmmoCount(actwep:GetSecondaryAmmoType()), "Arial24", ScrW() - 65, ScrH() - 55, Color(255, 255, 255, 255), 1, 0)
		end
	end
	
	if (InvasionSettings.EnableInfoBar) then
		draw.RoundedBox( 0, 0, 20, ScrW(), 60, Color( 0, 0, 0, 180 ) )
		draw.SimpleText( GetConVarString("hostname"), "Tahoma32", (ScrW() / 2) + 100, 25, Color(255, 255, 255, 255), 1, 0)
		draw.SimpleText( game.GetMap(), "MenuLarge", (ScrW() - 10), 55, Color(255, 255, 255, 255), 2, 0)
		
	end
	
	for _, ent in pairs(ents.GetAll()) do
		if (ValidEntity(ent) && ent:IsNPC()) then
			local tblNPCTable = NPCTable(ent:GetNWString("Name"))
			if !tblNPCTable then return end
			local posNPCPos = (ent:GetPos() + Vector(0, 0, tblNPCTable.Height or 0)):ToScreen()
			draw.SimpleTextOutlined(tblNPCTable.PrintName, "UiBold", posNPCPos.x, posNPCPos.y - 10,
			Color(0,0,0, 255), 1, 1, 1, Color(255,255,255,255))
			draw.SimpleTextOutlined(ent:GetNWInt("Level"), "UiBold", posNPCPos.x, posNPCPos.y ,
			Color(0,0,0, 255), 1, 1, 1, Color(255,255,255,255))
		end
	end
	


end

function hidedefaulthud(name)
	for k, v in pairs{"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"} do
		if name == v then return false end
	end
end
hook.Add("HUDShouldDraw", "hidedefaulthud", hidedefaulthud)

